// 仪表盘
var channelSales1 = document.querySelector(".box2 .echart");
var channelSalesMyChart1 = echarts.init(channelSales1);
option = {
  series: [
    {
      type: "gauge",
      radius: "130%", // 增加半径以使仪表盘变大
      center: ["50%", "70%"],
      min: 0,
      max: 150,
      startAngle: 190,
      endAngle: -10,
      progress: {
        show: true,
        width: 8,
        itemStyle: {
          color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
            {
              offset: 0,
              color: "#2d59c8",
            },

            {
              offset: 1,
              color: "#41CDCD",
            },
          ]),
        },
      },
      pointer: {
        show: false,
      },
      axisLine: {
        // show: false,
        lineStyle: {
          width: 8,
          color: [
            [
              1,
              {
                type: "linear",
                x: 0.5,
                y: 0.5,
                r: 0.5,
                colorStops: [
                  {
                    offset: 0,
                    color: "#233155", // 0% 处的颜色
                  },
                  {
                    offset: 1,
                    color: "#233155", // 100% 处的颜色
                  },
                ],
                globalCoord: false, // 缺省为 false
              },
            ],
          ],
        },
      },
      axisTick: {
        show: false,
      },
      splitLine: {
        show: false,
        length: 15,
        lineStyle: {
          width: 2,
          color: "#999",
        },
      },
      axisLabel: {
        show: false,
        color: "#fff",
        formatter: function (value) {
          if (value == 0 || value == 4) {
            return value;
          } else {
            return null;
          }
        },
        distance: -30,
        padding: [20, 20, 20, 20],
      },

      anchor: {
        show: false,
        showAbove: true,
        size: 25,
        itemStyle: {
          borderWidth: 10,
        },
      },
      title: {
        show: false,
      },
      detail: {
        formatter: function (value) {
          return value + "%";
        },
        valueAnimation: true,
        fontSize: 20,
        offsetCenter: [0, "-20%"],
        color: "#fff",
      },
      data: [
        {
          value: 75,
        },
      ],
    },
  ],
};
channelSalesMyChart1.setOption(option);
